home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / redakcyjne / programy / PSPad editor 4.5.4 build 2356 beta / pspad454inst_en.exe / {app} / Template / Singleton.cs < prev    next >
Text File  |  2008-01-09  |  567b  |  28 lines

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace GoogleRequester
  6. {
  7.     public class Singleton
  8.     {
  9.         private static Singleton instance = null;
  10.         private static object lockObject = new object();
  11.  
  12.         private Singleton()
  13.         {
  14.         }
  15.  
  16.         public static Singleton GetInstance()
  17.         {
  18.             lock (lockObject)
  19.             {
  20.                  if (instance == null)
  21.                      instance = new Singleton();
  22.  
  23.                 return instance;
  24.             }
  25.         }
  26.  
  27.     }
  28. }